package com.august.shop.ware.service;

import com.august.common.to.SkuHasStockVo;
import com.august.common.to.mq.OrderTo;
import com.august.common.to.mq.StockLockedTo;
import com.august.shop.ware.vo.WareSkuLockVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.august.common.utils.PageUtils;
import com.august.shop.ware.entity.WareSkuEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author august
 * @email 379249906@qq.com
 * @date 2020-05-18 10:12:00
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void addStock(Long skuId, Long wareId, Integer skuNum);

    List<SkuHasStockVo> getSkusHasStock(List<Long> skuIds);

    Boolean orderLocKStock(WareSkuLockVo wareSkuLockVo);

    /**
     * 构建解锁库存
     * @param stockLockedTo
     */
    void buidUnlockStock(StockLockedTo stockLockedTo);

    /**
     * 订单关闭解锁库存
     * @param orderTo
     */
    void buidUnlockStock(OrderTo orderTo);
}

